package com.havey.ye;

/**
 * @author huaiwei.com.havey.ye
 * @description: 运算类工厂
 * @date 2021/2/9 15:12
 */
public class OperationFactory {

    public static Operation createOperation(String type){
        Operation operation=null;
        switch(type){
            case "+":
                operation=new AddOperation();
                break;
            case "-":
                operation=new SubOperation();
                break;
            case "*":
                operation=new MulOperation();
                break;
            case "/":
                operation=new DivOperation();
                break;
            default:
                operation=null;
        }
        return operation;
    }
}
